---@class SelectTargetAction :AbstractLeaf
local SelectTargetAction = ClientFight.CreateClass("SelectTargetAction",ClientFight.AbstractLeaf,ClientFight.IAction)
---@return EStatus
function SelectTargetAction:update()
   SkillRoleMgr.savePathFile( "[" ..self.fight.frame .."][目标选择]" ..self.fighter:print().."进行目标选择")
    local skillBean = self.fighter.prepareSkill.skillBean

    local target = self.fighter.duelTarget
    if target == nil then
        local skill = self.fighter.prepareSkill
        local ruleSelectorByBuff = skill.ruleSelectorByBuff
        if ruleSelectorByBuff then--这里,如果技能被buff强行修改了规则,则用强制规则
            --这里,不能在这里删除, 得真正技能使用成功时,再删除, (因为技能选择成功,不一定使用成功,可能后续AI又会重新选择其他技能)
            local byBuff = self.fighter:getByBuffUUID(ruleSelectorByBuff.buffUUID)
            if byBuff == nil then
                skill.ruleSelectorByBuff = nil
            end
        end
        target = ClientFight.SkillClientManager.selectAttackTarget(self.fight, self.fighter, skill, self.fighter.position,nil, false,true);
    end
    if target ~= nil then
        local logTarget = target.fighterId
        SkillRoleMgr.savePathFile( "["..self.fight.frame.."][目标选择]"..self. fighter:print().. "技能" ..skillBean.f_SkillID
                .. "选择"..logTarget .."为目标");
        self.fighter.prepareTarget = target;
        return EStatus.SUCCESS;
    end
   SkillRoleMgr.savePathFile("[" ..self.fight.frame.."][目标选择]" ..self.fighter:print().. "技能" ..skillBean.f_SkillID.. "选择攻击目标为空")
    self.fighter.prepareSkill = nil
    if skillBean.f_SkillType ~= SkillTypeEnum.NORMAL_ATTACK then
        self.fighter.skipSkill[skillBean.f_SkillID] = true
    end
    return EStatus.FAILURE
end